/*********************************************************************
* File:: CombatAndFinancesSampleAgent.h
* \brief The combat and finances API sample.
*********************************************************************/
#pragma once
#pragma warning (disable: 4482) // Ignore non-standard extension warnings

#include "../Agent.h"
using namespace agents;


namespace agents{ namespace samples{
	/**
	* \class CombatAndFinancesSampleAgent
	* \brief The combat and finances API sample.
	*
	* The agents respond to the following team chat messages:
	* - \c fireP or \c fP: Primary attack
	* - \c fireS or \c fS: Secondary attack
	* - \c reload or \c r: Reloads
	* - \c selectP or \c sP: Selects the primary weapon
	* - \c selectS or \c sS: Selects the secondary weapon
	* - \c select <weapon name>: Selects a weapon
	* - \c has <weapon name>: Checks whether it has a weapon
	* - \c drop: Drops the current weapon
	* - \c buy <weapon name>: Buys a weapon
	* - \c money: Reports the amount of money
	* - \c ammo: Reports the amount of ammunition
	* - \c ammoInClip or \c ammoC: Reports the amount of ammunition in clip
	* - \c armour: Reports the amount of armour
	* - \c inBuyZone: Reports whether it is in a Buy Zone
	* - \c withinBuyTime: Reports whether it is in Buy Time
	* - \c aimL or \c aL: Makes the agent aim to the left until \c stop is invoked
	* - \c aimR or \c aR: Makes the agent aim to the right until \c stop is invoked
	* - \c aimU or \c aU: Makes the agent aim upwards until \c stop is invoked
	* - \c aimD or \c aD: Makes the agent aim downards until \c stop is invoked
	* - \c aimAtHere or \c a: Makes the agent aim towards the player
	* - \c moveToHere or \c mH: Makes the agent move to the player position
	* - \c stop: Stops the agent
	*
	* \author Instituto Superior Tecnico de Lisboa, Portugal
	* \author Technical University of Lisbon, Portugal
	* 
	* \author Agentes Autonomos e Sistemas Multiagente
	* \author Autonomous Agents and Multiagent Systems
	* 
	* \version	1.0
	* \date		2006/2007
	**/
	class CombatAndFinancesSampleAgent: public Agent{
	public:
		CombatAndFinancesSampleAgent(edict_t *enity, int team, int model);
		~CombatAndFinancesSampleAgent();

	private:
		void stop();
		void think();
		void handleMessage(ICommunication::MessageRecord& record);
		
		enum Operations
		{
			aimLeft = 0, 
			aimRight, 
			aimUp, 
			aimDown, 
			max
		};

		typedef struct record_s
		{
			bool enabled;
			double timeout;
		} record_t;

		record_t records[Operations::max];

		bool _isAiming;
		Vector _aimTarget;
	};
}}